import { commonState } from '@/common/index.js'
import { systemStoreHook } from '@/stores/modules.js'

const systemStore = systemStoreHook();
export const pageSearch = reactive({
    pageNumber: commonState.pageNumber,
    pageSize: commonState.pageSize
});
export const tableState = reactive({
    totalCount: 0,
    records: []
});

export const state = reactive({
    selectedRowKeys: [],
    loading: false,
    subLoading: false,
    checkedKeys: [],
    menus: [],
})
export const setLoading = (loading) => {
    state.loading = loading;
}

export const setSubLoading = (loading) => {
    state.subLoading = loading;
}

//表单列表
export const columns = [
    {
        title: '角色名称',
        dataIndex: 'name',
        key: 'name',
        align: 'center'
    },
    {
        title: '创建时间',
        dataIndex: 'createDate',
        key: 'createDate',
        align: 'center'
    },
    {
        title: '备注',
        dataIndex: 'description',
        key: 'description',
        align: 'center'
    },
    {
        title: '操作',
        key: 'operation',
        fixed: 'right',
        align: 'center',
        width: 100,
    }
]
export const rules = reactive({
    name: [{required: true, message: '请输入角色名称', trigger: 'blur'}],
});

//查询
export const searchState = reactive ({
})

//明细
export const detailState = reactive({

})
//设置查询参数
export function setSearchParam() {
    Object.assign(pageSearch, systemStore.getRoleSearch);
    return pageSearch;
}
